#!/usr/bin/python

f1 = open("cromo.dat","r",encoding="utf-8")
f2 = open("tabelas/avaliarE.txt","r",encoding="utf-8")
corretos = 0
l1 = [l.strip() for l in f1]
l2 = [l.strip() for l in f2]
i = 0
count = 0
frases = 0
frasesCorretas = 0


while i < len(l1):
    frases = frases + 1
    if l1[i] == l2[i]:
        frasesCorretas = frasesCorretas + 1
    s1 = l1[i].split()
    s2 = l2[i].split()
    j = 0
    while j < len(s1):
        count = count + 1
        if s1[j] != s2[j]:
            print("diferente " + s1[j] + " != " + s2[j])
        else:
            corretos = corretos + 1
        j = j + 1
        
    i = i + 1
print("Relatório: " + str(corretos) + " de " + str(count) + " ou " + str(100*corretos/count) + "% das palavras\n")
print("Relatório: " + str(frasesCorretas) + " de " + str(frases) + " ou " + str(100*frasesCorretas/frases) + "% das frases\n")
